package com.application.meizhi.ui.widget;

import android.content.Context;
import android.os.Bundle;
import android.view.WindowManager;

import com.application.meizhi.R;


/**
 * Created by Administrator on 2016/8/25 0025.
 */
public class ProgressDialog extends android.app.ProgressDialog {
    public ProgressDialog(Context context) {
        super(context);
    }

    public ProgressDialog(Context context, int theme) {
        super(context, theme);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        init(getContext());
    }

    private void init(Context context) {
//设置不可取消，点击其他区域不能取消，实际中可以抽出去封装供外包设置
        /*setCancelable(mCancelable);
        setCanceledOnTouchOutside(mCanceledOnTouchOutside);*/

        setContentView(R.layout.load_dialog);
        WindowManager.LayoutParams params = getWindow().getAttributes();
        params.width = WindowManager.LayoutParams.WRAP_CONTENT;
        params.height = WindowManager.LayoutParams.WRAP_CONTENT;
        getWindow().setAttributes(params);
    }

    @Override
    public void setCancelable(boolean flag) {

        super.setCancelable(flag);
    }

    @Override
    public void setCanceledOnTouchOutside(boolean cancel) {
        super.setCanceledOnTouchOutside(cancel);
    }

}
